#include "dialog.h"
#include "ui_dialog.h"
#include "event_filter.h"
#include <QKeyEvent>

Dialog::Dialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::Dialog)
{
    ui->setupUi(this);
    //installEventFilter(new EventFilter(this));
    m_bClosed = false;
}

void Dialog::keyPressEvent(QKeyEvent *event)
{
    switch (event->key())
    {
//    case Qt::Key_Escape:
//        break;
    default:
        QDialog::keyPressEvent(event);
    }
}

void Dialog::closeEvent(QCloseEvent *event)
{
    event->accept();
    m_bClosed = true;
}

void Dialog::reject()
{
    if (m_bClosed)
        QDialog::reject();
}

Dialog::~Dialog()
{
    delete ui;
}
